package com.gdkj.enums;

/**
 * 星球探索-道具
 *
 * @author: zw
 * @date: 2022/10/31
 **/
public enum DiggingPropEnums {
    CT(1, "锄头"),
    CZ(2, "铲子"),
    ZD(3, "炸弹"),
    RYM(4, "任意门"),
    TR(5, "土壤"),
    BHZ(6, "保护罩"),
    XHW(7, "小黑屋"),
    YS(8, "钥匙"),
    NLDJ(9, "钻石"),
    WJ(11, "挖机"),
    ZT(12, "钻头"),
    JADE(13,"玉石"),
    GOLD_BEAN(1000, "金豆");

    private Integer code;

    private String name;

    DiggingPropEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据code获取name值
     * @author chenyanqian
     * @date 2022/11/2
     * @param code : code
     * @return : java.lang.String
     */
    public static String getPropNameByCode(Integer code){
        DiggingPropEnums[] enums = DiggingPropEnums.values();
            for (DiggingPropEnums diggingPropEnum : enums){
                if(diggingPropEnum.code.equals(code)){
                    return diggingPropEnum.name;
                }
            }
            return null;
    }


    public static Integer getCodeByPropName(String name){
        DiggingPropEnums[] enums = DiggingPropEnums.values();
        for (DiggingPropEnums diggingPropEnum : enums){
            if(diggingPropEnum.name.equals(name)){
                return diggingPropEnum.code;
            }
        }
        return null;
    }
}
